package com.zy.controller;

import com.zy.entity.Page;
import com.zy.entity.VideoText;
import com.zy.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.websocket.server.PathParam;

/**
 * 首页
 * @author 张宇
 * @date 2021/7/27 17:50
 */
@Controller
public class IndexController
{

    @Autowired
    private HomeService homeService;

    /**
     * 最新视频
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ResponseBody
    @GetMapping("/videoNewest")
    public Page<VideoText> videoNewest(@PathParam("pageNo") int pageNo, @PathParam("pageSize") int pageSize)
    {
        return homeService.videoListByPageNoAndPageSize(pageNo, pageSize);
    }

    /**
     * 热门视频
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ResponseBody
    @GetMapping("/hotVideo")
    public Page<VideoText> hotVideo(int pageNo, int pageSize)
    {
        return homeService.hotVideoListByPageNoAndPageSize(pageNo, pageSize);
    }

}
